import { template } from "lodash";
import { h, init } from "snabbdom";

document.getElementById("app").innerHTML = loadshComponent({
  title: "lodash组件",
});

function loadshComponent(props) {
  const compiler = template("<h1><%= title %></h1>");
  return compiler(props);
}

const patch = init([]);

const MyComponent = (props) => {
  return h("h1", props.title);
};

// 组件的产出是 VNode
const prevVnode = MyComponent({ title: "lodash_template渲染" });
// 将 VNode 渲染成真实 DOM
patch(document.getElementById("app"), prevVnode);
